package com.open.rbac.model.entity.sys;


import jakarta.persistence.Column;
import jakarta.persistence.Convert;
import jakarta.persistence.Entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

import com.open.center.jpa.model.entity.IdSpecify;
import com.open.rbac.constant.BooleanType;


@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@DynamicUpdate
@SQLRestriction("is_deleted = false")
@SQLDelete(sql = "UPDATE role SET is_deleted = 1 WHERE id = ?")
@Entity(name = "role")
public class Role extends IdSpecify {

    @Column(name = "name", nullable = false, length = 64)
    private String name;

    @Convert(converter = BooleanType.Converter.class)
    @Column(name = "immutable", nullable = false)
    private BooleanType immutable;

    @Column(name = "enable", nullable = false)
    private Boolean enable;

    @Column(name = "remark")
    private String remark;

}
